import videoComponent from './video.vue'
let $vm
export default {
  install (Vue) {
    let Video = Vue.extend(videoComponent)
    if (!$vm) {
      $vm = new Video({el: document.createElement('div')})
      document.body.appendChild($vm.$el)
    }
    const video = {
      open (url) {
        $vm.open(url)
      },
      close () {
        $vm.close()
      }
    }
    Vue.$video = video
    Vue.mixin({
      created: function () {
        this.$video = Vue.$video
      }
    })
  }
}
